<template>
    <div class="all">
        <div style="margin-left: 10px;">
            <i class="el-icon-s-management"></i><span> 信息维护</span>
        </div>
        <el-card class="box-card" >
            <el-form :model="form"  ref="form" style="width: 500px; margin: 0 auto;">
            <el-form-item label="学号" label-width="90px" prop="number">
                <el-input v-model="form.number" autocomplete="off" :disabled="true"></el-input>
            </el-form-item>
            <el-form-item label="姓名" label-width="90px" prop="name">
                <el-input v-model="form.name" autocomplete="off" :disabled="true"></el-input>
            </el-form-item>
             <el-form-item label="教学系" label-width="90px" prop="departmentName">
                <el-input v-model="form.departmentName" autocomplete="off" :disabled="true"></el-input>
            </el-form-item>
            <el-form-item label="专业" prop="classId"  label-width="90px" props="majorName">
                 <el-input v-model="form.majorName" autocomplete="off" :disabled="true"></el-input>
            </el-form-item>
            <el-form-item label="班级" label-width="90px" prop="className">
                <el-input v-model="form.className" autocomplete="off" :disabled="true"></el-input>
            </el-form-item>
            <el-form-item label="Email" label-width="90px" prop="emalil">
                <el-input v-model="form.emalil" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="生日" label-width="90px" prop="birthday">
                <el-date-picker type="date" placeholder="选择日期" v-model="form.birthday"
                    style="width: 40%;"></el-date-picker>
            </el-form-item>
            <el-form-item label="性别" label-width="90px" prop="sex">
                <el-radio-group v-model="form.sex">
                    <el-radio :label="1">男</el-radio>
                    <el-radio :label="0">女</el-radio>
                </el-radio-group>
            </el-form-item>
             <el-form-item label="密码" label-width="90px" prop="password">
                <el-input v-model="form.password" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item  label="操作" label-width="90px">
                <el-button type="primary" @click="submit">确定更新</el-button>
            </el-form-item>
        </el-form>
        </el-card>
    </div>
</template>

<script>
import { studentinfo } from '@/api/student/courseSelect';
import { studentupdateinfo } from '@/api/student/courseSelect';
export default {
data(){
    return{
        form:{
            name:"",
            number:"",
            majorName:"",
            className:"",
            sex:"",
            emalil:"",
            departmentName:"",
            birthday:""
        },
    }
},
methods:{
    submit(){
        studentupdateinfo(this.form).then(res=>{
            // console.log(res);
               if (res.code === 0) {
                          this.$message({
                            type: 'success',
                            message: '更新成功'
                          })
                        }
        })
    },
    getlist(){
        studentinfo().then(res=>{
            this.form.name=res.data.name
            this.form.number=res.data.number
            this.form.departmentName=res.data.departmentName
            this.form.className=res.data.className
            this.form.majorName=res.data.majorName
            this.form.sex=res.data.sex
            this.form.birthday=res.data.birthday
            this.form.emalil=res.data.emalil
        })

    }
},
mounted(){
    this.getlist()
}
}
</script>

<style lang="scss" scoped>
.all {
    background-color: #ccc;
    height: 100%;
    width: 100%;

    .el-card {

        width: 98%;
        margin: 5px auto 0;
        height: 96%;

        .header {
            display: flex;
            justify-content: space-between;
        }
    }
}
</style>